<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>查找最大值和最小值</title>
</head>
<body>
        <h1><a href="../default.html">返回主页</a></h1>
    <script>
        var a = [45,1,3,5,78,15,48];
        var max=min=a[0];
        for(var i=0;i<a.length;i++){
            if(max<a[i]){
                max=a[i];
            }
            if(min>a[i]){
                min=a[i];
            }
        }
        document.write('数组为：'+a+'<br>');
        document.write('最大值为：'+max+'<br>'+'最小值为：'+min);
    </script>
</body>
</html>